package com.zcxy.web.controller.edu;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zcxy.common.annotation.Log;
import com.zcxy.common.core.controller.BaseController;
import com.zcxy.common.core.domain.AjaxResult;
import com.zcxy.common.enums.BusinessType;
import com.zcxy.edu.domain.EduAllSms;
import com.zcxy.edu.service.IEduAllSmsService;
import com.zcxy.common.utils.poi.ExcelUtil;
import com.zcxy.common.core.page.TableDataInfo;

/**
 * 发送短信配置Controller
 *
 * @author ruoyi
 * @date 2024-11-02
 */
@RestController
@RequestMapping("/edu/allSms")
public class EduAllSmsController extends BaseController
{
    @Autowired
    private IEduAllSmsService eduAllSmsService;

    /**
     * 查询发送短信配置列表
     */
    @PreAuthorize("@ss.hasPermi('edu:allSms:list')")
    @GetMapping("/list")
    public TableDataInfo list(EduAllSms eduAllSms)
    {
        startPage();
        List<EduAllSms> list = eduAllSmsService.selectEduAllSmsList(eduAllSms);
        return getDataTable(list);
    }

    /**
     * 导出发送短信配置列表
     */
    @PreAuthorize("@ss.hasPermi('edu:allSms:export')")
    @Log(title = "发送短信配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EduAllSms eduAllSms)
    {
        List<EduAllSms> list = eduAllSmsService.selectEduAllSmsList(eduAllSms);
        ExcelUtil<EduAllSms> util = new ExcelUtil<EduAllSms>(EduAllSms.class);
        util.exportExcel(response, list, "发送短信配置数据");
    }

    /**
     * 获取发送短信配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('edu:allSms:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(eduAllSmsService.selectEduAllSmsById(id));
    }

    /**
     * 新增发送短信配置
     */
    @PreAuthorize("@ss.hasPermi('edu:allSms:add')")
    @Log(title = "发送短信配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EduAllSms eduAllSms)
    {
        return toAjax(eduAllSmsService.insertEduAllSms(eduAllSms));
    }

    /**
     * 修改发送短信配置
     */
    @PreAuthorize("@ss.hasPermi('edu:allSms:edit')")
    @Log(title = "发送短信配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EduAllSms eduAllSms)
    {
        return toAjax(eduAllSmsService.updateEduAllSms(eduAllSms));
    }

    /**
     * 删除发送短信配置
     */
    @PreAuthorize("@ss.hasPermi('edu:allSms:remove')")
    @Log(title = "发送短信配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(eduAllSmsService.deleteEduAllSmsByIds(ids));
    }
}
